import UIKit

var str = "Hello, playground"


class MyArray{
    
    var array:Array<Int>
    
    init(patam:Int...) {
        array = patam
    }
    
    //定义下标
    subscript(index:Int)->Int{
        
        set{
            array[index] = newValue
        }
        
        get{
            return array[index]
        }
    }
}

var myArray = MyArray(patam: 1,2,3,4,5)

print(myArray[2])
